package arghhh.implementaçao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {

    private Connection connection = null;
    private static Conexao conexao = null;

    private Conexao(){
        try {
			Class.forName("net.sourceforge.jtds.jdbc.Driver");
			connection = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/DB_Arghhh","sa","senha");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}
    }

    public synchronized static Conexao getInstance(){
        if(conexao == null){
            conexao = new Conexao();
        }
        return conexao;
    }

    public Connection getConnection(){
        return connection;
    }
}